<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>es5兼容object.is写法</title>
</head>
<body>
<script>
    Object.defineProperty(Object,'is',{
        value:function(x,y){
          if(x===y){
              return x!==0||1/x===1/y;//处理 +0 =-0的情况
          }
          return x!==x&&y!==y;
        },
        configurable:true,
        enumerable:false,
        writable:true
    })
</script>
</body>
</html>